package com.base.llpark.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.util.SparseArray;
import android.view.View;

/**
 * Created by arvin on 2018/8/15.
 */

public class BaseHolder extends RecyclerView.ViewHolder {

    private SparseArray<View> mViews;
    private View mConvertView;
    public BaseHolder(View itemView) {
        super(itemView);
        mConvertView=itemView;
        mViews=new SparseArray<>();
    }





    public static BaseHolder getHolder(Context context, View v)
    {
        BaseHolder baseHolder = new BaseHolder(v);
        return baseHolder;
    }

    public <T extends View>T getView(int Id)
    {
        View view = mViews.get(Id);
        if(view==null)
        {
            view = mConvertView.findViewById(Id);
            mViews.put(Id,view);

        }
        return (T)view;
    }




}
